package com.dmzapp.api.servlet;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.dmzapp.api.cache.redis.MiddleRedisServer;

/**
 * Servlet implementation class for Servlet: DownloadCountServlet
 *
 */
 public class DownloadAPKServlet extends com.dmzapp.api.servlet.DMZSerlvet implements javax.servlet.Servlet {
   static final long serialVersionUID = 1L;
   
    /* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#HttpServlet()
	 */
	public DownloadAPKServlet() {
		super();
	}

    @Override
    protected void handle(HttpServletRequest request, HttpServletResponse response) {
        
        MiddleRedisServer.getInstance().recordDownloadApkCount(System.getProperty("apkversioncode"));
        
        try {
            response.sendRedirect(System.getProperty("apkdownloadurl"));
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }   	
		  	    
}